package com.zy.UserMapper;
//注解的形式

import com.zy.Domain.User;
import org.apache.ibatis.annotations.*;

import java.sql.ResultSet;
import java.util.List;

public interface UserMapper
{
    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into user(username,password,address) values(#{username},#{password},#{address})")
    public int insertUser(User user);

    @Delete("delete from user where id=#{id}")
    public int deleteUser(int id);

    @Update("update user set username=#{username},password=#{password} where id=#{id}")
    public int updateUser(User user);

    @Select("select * from user where id=#{id}")
    public User selectUser(int id);

    @Select("select * from user where username=#{username}")
    public List<User> selectUsers(String username);
}
